home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-01
/
snip1292.zip
/
SCROLL.C
< prev
next >
Wrap
C/C++ Source or Header
|
1992-12-26
|
2KB
|
83 lines
/*--------------------------[ scroll ]--------------------------*/
/* Scroll the active page up or down a number of lines */
/* Public domain code by Jeff Dunlop: */
/*--------------------------------------------------------------*/
/* input: */
/* dx = direction */
/* num_lines = number of lines to scroll, 0 = clear coords */
/* attr = attribute of blank line(s) */
/* y1, x1, y2, x2 = corner coordinates of scroll window */
/* local: */
/* regs = register union for ISR */
/*--------------------------------------------------------------*/
#include <dos.h>
#define SCROLL_UP 0
#define SCROLL_DN 1
void scroll(int direction,
int num_lines,
int vattrib,
int ulrow,
int ulcomumn,
int lrrow,
int lrcolumn)
{
union REGS regs;
/*
BH = attribute to be used on blank line
CH = row of upper left corner of scroll window
CL = column of upper left corner of scroll window
DH = row of lower right corner of scroll window
DL = column of lower right corner of scroll window
*/
regs.h.al = (unsigned char)num_lines;
regs.h.bh = (unsigned char)vattrib;
regs.h.ch = (unsigned char)ulrow;
regs.h.cl = (unsigned char)ulcomumn;
regs.h.dh = (unsigned char)lrrow;
regs.h.dl = (unsigned char)lrcolumn;
if (direction == SCROLL_UP)
regs.h.ah = 0x06;
else regs.h.ah = 0x07;
int86(0x10, ®s, ®s);
}
/*
** Portable PC clear screen function
** Public domain by Bob Stout
** Uses SCRNSIZE.C functions
*/
#ifndef __TURBOC__
#define far _far
#endif
#define Vpage (*((unsigned char far *)0x00400062))
void ClrScrn(int vattrib)
{
union REGS regs;
scroll(SCROLL_UP, 0, vattrib, 0, 0, get_screen_rows(),
get_screen_cols());
regs.h.ah = 2; /* Home cursor */
regs.h.bh = Vpage;
regs.x.dx = 0;
int86(0x10, ®s, ®s);
}
#ifdef TEST
void main(void)
{
ClrScrn(7);
}
#endif